/**
 * 
 */
package com.rst.org.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @author JavaDeamon
 *
 */
@Entity
@Table(name="LOCATION_DETAILS")
public class LocationDetailsDTO implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8197443783281989942L;
	private String locId;
	private String locName;
	private String locCode;
	private Boolean hasChild;
	private OrganizationDetailsDTO orgId;
	
	
	/**
	 * @return the locId
	 * Primary Key
	 * auto generated
	 */
	@Id
	@Column(name="LOC_ID", length=10)
	public String getLocId() {
		return locId;
	}
	/**
	 * @return the locName
	 * contain name of location
	 * column cannot be null
	 * length is 50
	 */
	@Column(name="LOC_NAME", nullable=false, length=50)
	public String getLocName() {
		return locName;
	}
	/**
	 * @return the locCode
	 * contain code for location
	 * column is optional
	 * length is 10
	 */
	@Column(name="LOC_CODE", nullable=false, length=10)
	public String getLocCode() {
		return locCode;
	}
	/**
	 * @return the hasChild
	 * boolean column 0-noChild 1-hasChild
	 * default value 0
	 */
	@Column(name="HAS_CHILD", columnDefinition="smallint default 0")
	public Boolean getHasChild() {
		return hasChild;
	}
	/**
	 * @return the orgId
	 * contains the organization id in which location exists
	 * cannot be null
	 * one to one mapping with org_id of organization details table 
	 */
	
	@OneToOne(targetEntity=OrganizationDetailsDTO.class)
	@JoinColumn(name="ORG_ID", nullable=false)
	public OrganizationDetailsDTO getOrgId() {
		return orgId;
	}
	/**
	 * @param locId the locId to set
	 */
	public void setLocId(String locId) {
		this.locId = locId;
	}
	/**
	 * @param locName the locName to set
	 */
	public void setLocName(String locName) {
		this.locName = locName;
	}
	/**
	 * @param locCode the locCode to set
	 */
	public void setLocCode(String locCode) {
		this.locCode = locCode;
	}
	/**
	 * @param hasChild the hasChild to set
	 */
	public void setHasChild(Boolean hasChild) {
		this.hasChild = hasChild;
	}
	/**
	 * @param orgId the orgId to set
	 */
	public void setOrgId(OrganizationDetailsDTO orgId) {
		this.orgId = orgId;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "LocationDetailsDTO [locId=" + locId + ", locName=" + locName
				+ ", locCode=" + locCode + ", hasChild=" + hasChild
				+ ", orgId=" + orgId + "]";
	}
}
